export default [
    {
        path: '/',
        component: () => import('@/pages/Home'),
        meta: {show: true}
    },
    {
        path: '/home',
        component: () => import('@/pages/Home'),
        meta: {show: true}
    },
    {
        path: "/search/:keyword?",
        component: () => import('@/pages/Search'),
        meta: {show: true},
        name: 'search',
        // 函数写法
        // props: ($route) => {
        //     return {keyword: $route.params.keyword,k: $route.query.k}
        // }
    },
    {
        path: '/login',
        component: () => import('@/pages/Login'),
        meta: {show: false}
    },
    {
        path: '/register',
        component: () => import('@/pages/Register'),
        meta: {show: false}
    },
    {
        path: '/detail/:skuId',
        component: () => import('@/pages/Detail'),
        meta: {show: true}
    },
    {
        path: '/addcartsuccess',
        name: 'addcartsuccess',
        component: () => import('@/pages/AddCartSuccess'),
        meta: {show: true}
    },
    {
        path: '/shopCart',
        name: 'shopCart',
        component: () => import('@/pages/ShopCart'),
        meta: {show: true}
    },
    {
        path: '/trade',
        name: 'trade',
        component: () => import('@/pages/Trade'),
        meta: {show: true},
        beforeEnter: (to,from,next) => {
            if(from.path == '/shopCart') {
                next();
            }else {
                next(false);
            }
        }
    },
    {
        path: '/pay',
        name: 'pay',
        component: () => import('@/pages/Pay'),
        meta: {show: true},
        beforeEnter: (to,from,next) => {
            if(from.path == '/trade') {
                next();
            }else {
                next(false);
            }
        }
    },
    {
        path: '/paySuccess',
        name: 'paySuccess',
        component: () => import('@/pages/PaySuccess'),
        meta: {show: true}
    },
    {
        path: '/center',
        name: 'center',
        component: () => import('@/pages/Center'),
        meta: {show: true},
        children: [
            {
                path: 'myOrder',
                component: () => import('@/pages/Center/myOrder'),
            },
            {
                path: 'groupOrder',
                component: () => import('@/pages/Center/groupOrder'),
            },
            {
                path: '/center',
                redirect: '/center/myOrder'
            }
        ]
    }
]